package com.ruoyi.common.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;

public class Tools {

    //获取32位UID
    public static String createUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
    }

    //日期格式化到秒
    public static String formateDateforSecond(Date date) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (date == null)
            return "";
        else

            return df.format(date);
    }
    //日期格式化到秒CN
    public static String formateDateforSecondCN(Date date) {
        DateFormat df = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
        if (date == null)
            return "";
        else

            return df.format(date);
    }

    //日期格式化到天
    public static String formateDateforDay(Date date) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        if (date == null)
            return "";
        else

            return df.format(date);
    }

    //日期格式化到天 CN
    public static String formateDateforDayCN(Date date) {
        DateFormat df = new SimpleDateFormat("yyyy年MM月dd日");
        if (date == null)
            return "";
        else

            return df.format(date);
    }

    //获取系统当前时间
    public static Date getCurrentDateTime(){
        Calendar ca=Calendar.getInstance();
        return ca.getTime();
    }
}
